// Copyright 2007 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package lichen.services.forum;

import java.util.List;

import lichen.entities.forum.Treeable;

/**
 * 对论坛类进行操作的接口.
 * @author jcai
 * @version $Revision: 7 $
 * @since 0.0.1
 */
public interface ForumClassService {

	/**
	 * 保存树型结构的一个节点.此方法只是针对新建树节点时候，
	 * <p>
	 * 需要注意的是：在调用改方法之前，一定不能先保存了改节点
	 * 
	 * @param node            待保存的节点
	 * @param parentNode 父节点
	 * @param clazz 待保存实体的类
	 */
	public abstract void saveTreeChildNode(Treeable node,
			Treeable parentNode, Class clazz);

	/**
	 * 得到完整树
	 * 
	 * @param clazz
	 *            对应的类
	 */
	@SuppressWarnings("unchecked")
	public abstract List<? extends Treeable> getTree(
			Class<? extends Treeable> clazz);

	/**
	 * 同级移动节点.
	 * <p>
	 * 当n>0的时候，为向上移动， 当 n<0的时候，为向下移动.
	 * 
	 * @param node
	 *            节点
	 * @param n
	 *            移动的位置
	 * @param clazz
	 *            给定的查询类
	 */
	public abstract void moveNode(Treeable node, int n, Class clazz);

	/**
	 * 删除一个节点
	 * 
	 * @param node
	 *            节点
	 * @param clazz
	 *            用来查询的模型类.
	 */
	public abstract void deleteTreeNode(Treeable node, Class clazz);

}